#include <iostream>
#include <string>
#include <jsoncpp/json/json.h>
#include <jsoncpp/json/value.h>
using namespace std;

void Serialize()
{
  const char* name = "六盘水";
  int age =20;
  float score[] = {66.5,77.5,88};
  Json::Value val;
  val["姓名"] = name;
  val["年龄"] = age;
  val["成绩"].append(score[0]);
  val["成绩"].append(score[1]);
  val["成绩"].append(score[2]);

  Json::Value root;
  root.append(val);
  cout << root << endl;
  cout << "-------------------" << endl;
  Json::StyledWriter writer;
  std::string str = writer.write(root);
  cout << str << endl;
   
}


int main()
{
  Serialize();
  return 0;
}
